<!---
	Title:		Elders Program Database meals form
	Author:		Bruce Frick
	Purpose:	.
--->

<cfset BASE = CreateObject("component", "cfc.base") />


<cfoutput>
<!---HTML header, css links, js links, and page title--->
#BASE.htmlHeader("/jquery/ui-1.8.5/jquery-ui.min.js,js/meals.js", 
	"css/style.css,/jquery/ui-1.8.5/themes/base/jquery-ui.css", "Elders Program - Meals Form")#
<!---HTML header, css links, js links, and page title--->

<cfform id="myform">

<!---Im using standard html input elements.  The cf input elements are very 
slow compared to standard html, when using the AJAX techniques below.--->
  
<table width="99%" cellpadding="1" cellspacing="0">
    <tbody class="header_title">
        <tr>
            <td colspan="2">
                <h2 id="dummy">Meals #dateFormat(Now(), "mm/dd/yyyy")#</h2>
            </td>
        </tr>
    </tbody>
</table>
<table width="99%" cellpadding="2" cellspacing="0" id="meals">
<tbody>
	<tr>
    	<td colspan="2" class="black_spacer">Meals Information</td>
    </tr>
	<tr>
    	<td align="right">Provider: </td>
        <td width="90%">
            <cfset QUERIES.providers = CreateObject("component", "cfc.utilities").funcGetDLProviders() />
            <cfselect id="providerID" name="providerID" selected=""  >
            	<!--- <option value="-1">- Choose Provider -</option> --->
                <cfloop from="1" to="#ArrayLen(QUERIES.providers)#" index="i">
                    <cfif QUERIES.providers[i].RosettaID eq 1>
                        <option value="#QUERIES.providers[i].RosettaID#" 
                            selected="selected">
                            #QUERIES.providers[i].FirstName# #QUERIES.providers[i].LastName#
                        </option>
                    <cfelse>
	                    <option value="#QUERIES.providers[i].RosettaID#">
	                        #QUERIES.providers[i].FirstName# #QUERIES.providers[i].LastName#
	                    </option>   
                    </cfif>
                    
                </cfloop>
            </cfselect>
        </td>
    </tr>
    <tr>
    	<td align="right">Date: </td>
        <td>
        	<cfinput type="text" id="meal_date" name="meal_date" size="10" value="#dateFormat(now(), 'mm/dd/yyyy')#" />
        </td>
    </tr>
    <tr>
    	<td align="right">Elder's:</td>
        <td>
        	<cfselect id="elders" name="elders" >
            <option value="">- Choose Elder -</option>
       	 	<cfset QUERIES.eldersNoContact =CreateObject("component", "cfc.queries").funcQryAllEldersNoContacts()/>
        	<cfloop query="QUERIES.eldersNoContact">
            <option value="#ELDERLISTID#">#LASTNAME#, #FIRSTNAME#</option>
        	</cfloop>
        	</cfselect>           
        </td>
    </tr>
    <tr>
    	<td align="right">Guest:</td>
        <td><cfinput type="text" id="elders_typein" name="elders_typein"  /></td>
    </tr>
    <tr>
    	<td>&nbsp;</td>
    	<td>
        	<cfinput type="button" id="add" name="add"  value="Sign Up" /> 
            <span id='error' style="display:none">Review the errors above.</span>
        </td>
    </tr>
</tbody>
</table>
<br />

<table width="99%" cellpadding="2" cellspacing="1" id="meals_list" >
<thead>
	<tr>
    	<th align="left" width="55%" class="black_spacer">Elders (Provider)</th>
        <th align="left" class="black_spacer">Guests</th>
    </tr>
</thead>
<tbody>
	<tr>
    	<!--- elders --->
    	<td valign="top" width="50%">
        	<cfset elderMeals = CreateObject("component", "cfc.queries").funcQryGetEldersMeals() />
        	<cfset utils = CreateObject("component", "cfc.utilities") />
        	<ol  id="elders_list">
                <cfloop query="elderMeals" >
                    <li>#elderMeals.FullName# ( #utils.funcFindProvider( elderMeals.ProviderID ).ProviderName# ) 
                        <img id="elder_#elderMeals.MealID#" src='images/list-remove.png' 
                        alt='Remove from list.' title='Remove from list.' 
                        class='clickable' align='absmiddle' />
                    </li>
                </cfloop>
            </ol>
        </td>
        <!--- elders --->
        
        <!--- guests --->
        <td valign="top"  width="50%">
            <cfset guestMeals = CreateObject("component", "cfc.queries").funcQryGetGuestMeals() />
        	<ol  id="guests_list">
                <cfloop query="guestMeals" >
                    <li>#guestMeals.GUESTNAME# 
                        <img id="guest_#guestMeals.GUESTMEALSID#" src='images/list-remove.png' 
                        alt='Remove from list.' title='Remove from list.' 
                        class='clickable' align='absmiddle' /></li>
                </cfloop>
            </ol>
        </td>
        <!--- elders --->
    </tr>
</tbody>
</table>
<!---this holds the logged in user for data submition.--->
<input type="hidden" id="signer" value="#CGI.AUTH_USER#" />

<!---this holds todays date for data submition.--->
<input type="hidden" id="sign_date" value="#dateFormat(now(),'mm/dd/yyyy')#" />
</cfform>


<!---HTML footer, closes html and body tags.  Any footer info goes here--->
#BASE.htmlFooter()#
<!---HTML footer, closes html and body tags.  Any footer info goes here--->
</cfoutput>